package com.googlecode.lazyrecords.chronicle.mappings;

import com.googlecode.lazyrecords.mappings.StringMappings;

import java.util.Map;

import static com.googlecode.totallylazy.Maps.map;

public class ChronicleMappings {
    private final Map<Class, ChronicleMapping<Object>> map = map();
    private final StringMappings stringMappings;

    public ChronicleMappings(StringMappings stringMappings) {
        this.stringMappings = stringMappings;
    }

    public ChronicleMappings() {
        this(new StringMappings());
    }

    public ChronicleMapping<Object> get(final Class aClass) {
        if (!map.containsKey(aClass)) {
            return new ObjectMapping(aClass, stringMappings);
        }
        return map.get(aClass);
    }
}
